/**
 * Created by MtRider on 2021/10/12 22:01
 */
public class test3 {
    public static void main(String[] args) {
        int i = mySqrt(2147483647);
        System.out.println(i);
    }
    public static int mySqrt(int x) {
        if (x == 1 || x == 0) {
            return x;
        }else{
            for(int i=0;i<x;i++){
                if(i*i==x){
                    return i;
                }else if(i==46340||(i*i<x&&(i+1)*(i+1)>x)){
                    System.out.println((double)46341*(double)46341>x);
                    System.out.println(i);
                    return i;
                }
            }
        }
        return 0;
    }
}
